package com.cn.wanxi.dao.impl;

import com.cn.wanxi.dao.AboutCompanyNameDao;
import com.cn.wanxi.model.ClothingTypeModel;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.util.JDBC;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class AboutCompanyNameImpl implements AboutCompanyNameDao {
    @Override
    public List<CompanyModel> getAboutCompanyName() {
        String sql = "select * from company where enable = 1 ";
        ResultSet resultset = JDBC.query(sql);
        List<CompanyModel> list = new ArrayList<>();
        try {
            while (resultset.next()) {
                CompanyModel companyModel = new CompanyModel();
                companyModel.setAddress(resultset.getString("address"));
                companyModel.setName(resultset.getString("name"));
                companyModel.setPicture(resultset.getString("picture"));
                list.add(companyModel);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return list;
    }
}
